<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
  
  // var obj = {
  //   name:"why",
  //   "my friend": "kobe",
  //   "eating something":function() {
  //     console.log("eating~")
  //   }
  // }
  // // obj.my friend 是不生效的
  // //可以采用方括号 里面放key的形式
  // console.log(obj["my friend"])
  // console.log(obj["name"])
  // console.log(obj.name)
  // //一种写法：obj["eating something"]()
  // var eatkey = "eating something"
  // obj[eatkey]()

  var message = "Hello World"
  var obj = {
    "good friend" : "why",
    [message]: "你好，世界"
  }
  console.log(obj["good friend"])
  console.log(obj[message])
  </script>
</body>
</html>